﻿/*-----------------------------------------------
// File: RoundEnterState.cs
// Description: 
// Author: Shaobing	492057342@qq.com
-----------------------------------------------*/
using UnityEngine;
using System.Collections;

namespace Battle.View
{
    public class RoundEnterState : Fsm.FsmStateBase<BattleRoundState>
    {
        protected BattleViewCtrl viewCtrl {
            get { return BattleViewCtrl.GetInstance(); }
        }
        protected BattleRoundCtrl ctrl {
            get { return this.controller as BattleRoundCtrl; }
        }


        public RoundEnterState(BattleRoundState state, BattleRoundCtrl ctrl) : base(state, ctrl) {
        }

        //bool isAsking = true;
        public override void Enter()
        {
            if (viewCtrl.isComboGuideNeed)
            {
                BattleManager.Instance.battlePanel.EnterComboGuide(Enter0);
                viewCtrl.isComboGuideNeed = false;
            }
            else
            {
                Enter0();
            }

        }

        void Enter0()
        {
            viewCtrl.hasRoundFight = false;
            viewCtrl.ResetCurrentShowBC();
            viewCtrl.isCanRoundOver = false;
            viewCtrl.ClearCurrentBehaivour();

            AskNewRound();
        }

        protected void AskNewRound() {
            viewCtrl.AskNewRound();
        }


        public virtual void NewRoundCallback() {
            if (ctrl.currentCamp == BattleCamp.Attacker)
            {
                BattleManager.Instance.battlePanel.EnterOurTurn();
            }
            else {
                BattleManager.Instance.battlePanel.LeaveOutTurn();
            }
            ctrl.SwitchState(BattleRoundState.RoundWaitState);
        }
    }
}